# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.spark_submit import SparkSubmitOperator
from jms.dm.dm_centersend_timerate_detail_v2_dt import jms_dm__dm_centersend_timerate_detail_v2_dt

jms_dm__dm_centersend_timerate_summary_v2_dt = SparkSubmitOperator(
    task_id='jms_dm__dm_centersend_timerate_summary_v2_dt',
    pool_slots=6,
    email=['wangmenglei@jtexpress.com','yl_bigdata@yl-scm.com'],
    name='jms_dm__dm_centersend_timerate_summary_v2_dt',
    driver_memory='4G' , 
    executor_memory='3G' , 
    executor_cores=2 , 
    num_executors=2,
    retries=0,
    conf={'spark.dynamicAllocation.enabled': 'true',  # 动态资源开启
          'spark.shuffle.service.enabled': 'true',  # 动态资源 Shuffle 服务开启
        'spark.dynamicAllocation.maxExecutors'             : 2 , 
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 60,  # 动态资源自动释放闲置 Executor 的超时时间(s)
          'spark.sql.sources.partitionOverwriteMode': 'dynamic',  # 允许删改已存在的分区
        'spark.executor.memoryOverhead'             : '2G' , 
          'spark.sql.shuffle.partitions': 200
          },
    jars='hdfs:///scheduler/jms/spark/chk/report/centersend_timerate_data_v2/pro/common-1.0-SNAPSHOT.jar',
    java_class='com.yunlu.bigdata.jobs.report.EndCenterSendTimeRateSummaryV2',
    application='hdfs:///scheduler/jms/spark/chk/report/centersend_timerate_data_v2/pro/original-jobs-1.0-SNAPSHOT.jar',
    application_args=['{{ execution_date | cst_ds }}'],
    execution_timeout=timedelta(hours=1)
)

jms_dm__dm_centersend_timerate_summary_v2_dt << [
    jms_dm__dm_centersend_timerate_detail_v2_dt
]